package com.group5.onlinegame.handler;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.group5.onlinegame.entity.Roles;
import com.group5.onlinegame.service.IRolesService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;


@Controller
@RequestMapping("/")
public class RoleManagerHandler {

    @Resource
    private IRolesService rolesService;

    @RequestMapping("lsitRoles")
    public String lsitRoles(Model model) {
        PageHelper.startPage(1,10);
        List<Roles> rolesList = rolesService.getListRoles();
        PageInfo<Roles> rolesPageInfo = new PageInfo<>(rolesList);
        model.addAttribute("rolesPageInfo",rolesPageInfo);
        return "role";
    }
}
